final class ItemDefinition {
	private int anInt326;
	private int anInt327;
	public byte[] aByteArray328;
	public String examine;
	private byte equipOffset2;
	private int anInt331;
	public int anInt332;
	public int anInt333;
	private int anInt334;
	public static int anInt335;
	private static ItemDefinition[] items;
	public static Cache aCache_337 = new Cache(50);
	public String[] aStringArray338;
	private int anInt339;
	private int anInt340;
	private int[] anIntArray341;
	private static int[] anIntArray342;
	public int anInt343;
	public static boolean aBoolean344 = true;
	public int anInt345;
	static Cache aCache_346 = new Cache(100);
	private static byte aByte347 = 6;
	public String[] actions;
	private boolean aBoolean349 = true;
	private static boolean aBoolean350 = true;
	private int anInt351 = -68;
	private static int anInt352;
	private int anInt353;
	public int anInt354;
	private int anInt355;
	public int anInt356;
	private int scale2;
	public int anInt358;
	public int anInt359;
	private int anInt360;
	public int anInt361;
	public int anInt362;
	public int anInt363 = -1;
	private int[] anIntArray364;
	public int[] anIntArray365;
	private int scale1;
	public int anInt367;
	private int scale3;
	public int zoom;
	public int anInt370;
	public boolean aBoolean371;
	public int anInt372;
	private static Packet aPacket_373;
	public int anInt375;
	public int[] anIntArray376;
	public boolean aBoolean377;
	private byte equipOffset1;

	public final boolean method211(int i, int i_0_) {
		int i_1_ = anInt334;
		int i_2_ = anInt361;
		if (i_0_ != 0) {
			aBoolean349 = !aBoolean349;
		}
		if (i == 1) {
			i_1_ = anInt375;
			i_2_ = anInt362;
		}
		if (i_1_ == -1) {
			return true;
		}
		boolean bool = true;
		if (!Model.method589(i_1_)) {
			bool = false;
		}
		if (i_2_ != -1 && !Model.method589(i_2_)) {
			bool = false;
		}
		return bool;
	}

	public static final ItemDefinition method212(int i) {
		for (int i_3_ = 0; i_3_ < 10; i_3_++) {
			if (ItemDefinition.items[i_3_].anInt363 == i) {
				return ItemDefinition.items[i_3_];
			}
		}
		ItemDefinition.anInt352 = (ItemDefinition.anInt352 + 1) % 10;
		ItemDefinition itemDefinition = ItemDefinition.items[ItemDefinition.anInt352];
		ItemDefinition.aPacket_373.offset = ItemDefinition.anIntArray342[i];
		itemDefinition.anInt363 = i;
		itemDefinition.method223();
		itemDefinition.method218(ItemDefinition.aByte347, ItemDefinition.aPacket_373);
		if (itemDefinition.anInt343 != -1) {
			itemDefinition.method215(0);
		}
		if (!ItemDefinition.aBoolean344 && itemDefinition.aBoolean377) {
			itemDefinition.examine = "Members Object";
			itemDefinition.aByteArray328 = "Login to a members' server to use this object.".getBytes();
			itemDefinition.aStringArray338 = null;
			itemDefinition.actions = null;
			itemDefinition.anInt332 = 0;
		}
		return itemDefinition;
	}

	public final Model method213(byte i, int i_4_) {
		int i_5_ = anInt353;
		int i_6_ = anInt331;
		int i_7_ = anInt370;
		if (i_4_ == 1) {
			i_5_ = anInt326;
			i_6_ = anInt355;
			i_7_ = anInt367;
		}
		if (i_5_ == -1) {
			return null;
		}
		Model model = Model.method588(i_5_);
		if (i != -98) {
			throw new NullPointerException();
		}
		if (i_6_ != -1) {
			if (i_7_ != -1) {
				Model model_8_ = Model
					.method588(i_6_);
				Model model_9_ = Model
					.method588(i_7_);
				Model[] class50_sub1_sub4_sub4s = { model,
					model_8_, model_9_ };
				model = new Model(3, class50_sub1_sub4_sub4s,
					(byte) -89);
			} else {
				Model model_10_ = Model
					.method588(i_6_);
				Model[] class50_sub1_sub4_sub4s = { model,
					model_10_ };
				model = new Model(2, class50_sub1_sub4_sub4s,
					(byte) -89);
			}
		}
		if (i_4_ == 0 && equipOffset1 != 0) {
			model.method601(0, 0, false, equipOffset1);
		}
		if (i_4_ == 1 && equipOffset2 != 0) {
			model.method601(0, 0, false, equipOffset2);
		}
		if (anIntArray364 != null) {
			for (int i_11_ = 0; i_11_ < anIntArray364.length; i_11_++) {
				model.method602(anIntArray364[i_11_], anIntArray341[i_11_]);
			}
		}
		return model;
	}

	public static final void method214(Archive archive) {
		ItemDefinition.aPacket_373 = new Packet(archive.method154("obj.dat",
			null));
		Packet packet = new Packet(archive.method154(
			"obj.idx", null));
		ItemDefinition.anInt335 = packet.getUShort();
		ItemDefinition.anIntArray342 = new int[ItemDefinition.anInt335];
		int i = 2;
		for (int i_12_ = 0; i_12_ < ItemDefinition.anInt335; i_12_++) {
			ItemDefinition.anIntArray342[i_12_] = i;
			i += packet.getUShort();
		}
		ItemDefinition.items = new ItemDefinition[10];
		for (int i_13_ = 0; i_13_ < 10; i_13_++) {
			ItemDefinition.items[i_13_] = new ItemDefinition();
		}
	}

	public void method215(int i) {
		ItemDefinition itemDefinition_14_ = ItemDefinition.method212(anInt343);
		anInt360 = itemDefinition_14_.anInt360;
		zoom = itemDefinition_14_.zoom;
		if (i != 0) {
			for (int i_15_ = 1; i_15_ > 0; i_15_++) {
				/* empty */
			}
		}
		anInt359 = itemDefinition_14_.anInt359;
		anInt356 = itemDefinition_14_.anInt356;
		anInt339 = itemDefinition_14_.anInt339;
		anInt327 = itemDefinition_14_.anInt327;
		anInt340 = itemDefinition_14_.anInt340;
		anIntArray364 = itemDefinition_14_.anIntArray364;
		anIntArray341 = itemDefinition_14_.anIntArray341;
		ItemDefinition itemDefinition_16_ = ItemDefinition.method212(anInt333);
		examine = itemDefinition_16_.examine;
		aBoolean377 = itemDefinition_16_.aBoolean377;
		anInt345 = itemDefinition_16_.anInt345;
		String string = "a";
		char c = itemDefinition_16_.examine.charAt(0);
		if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U') {
			string = "an";
		}
		aByteArray328 = ("Swap this note at any bank for " + string + " " + itemDefinition_16_.examine + ".")
			.getBytes();
		aBoolean371 = true;
	}

	public final boolean method216(int i, int i_17_) {
		while (i >= 0) {
			ItemDefinition.aBoolean350 = !ItemDefinition.aBoolean350;
		}
		int i_18_ = anInt353;
		int i_19_ = anInt331;
		int i_20_ = anInt370;
		if (i_17_ == 1) {
			i_18_ = anInt326;
			i_19_ = anInt355;
			i_20_ = anInt367;
		}
		if (i_18_ == -1) {
			return true;
		}
		boolean bool = true;
		if (!Model.method589(i_18_)) {
			bool = false;
		}
		if (i_19_ != -1 && !Model.method589(i_19_)) {
			bool = false;
		}
		if (i_20_ != -1 && !Model.method589(i_20_)) {
			bool = false;
		}
		return bool;
	}

	public final Model method217(int i, int i_21_) {
		if (anIntArray365 != null && i_21_ > 1) {
			int i_22_ = -1;
			for (int i_23_ = 0; i_23_ < 10; i_23_++) {
				if (i_21_ >= anIntArray376[i_23_] && anIntArray376[i_23_] != 0) {
					i_22_ = anIntArray365[i_23_];
				}
			}
			if (i_22_ != -1) {
				return ItemDefinition.method212(i_22_).method217(anInt351, 1);
			}
		}
		Model model = Model.method588(anInt360);
		while (i >= 0) {
			aBoolean349 = !aBoolean349;
		}
		if (model == null) {
			return null;
		}
		if (anIntArray364 != null) {
			for (int i_24_ = 0; i_24_ < anIntArray364.length; i_24_++) {
				model.method602(anIntArray364[i_24_], anIntArray341[i_24_]);
			}
		}
		return model;
	}

	public final void method218(byte i, Packet packet) {
		if (i != 6) {
			aBoolean349 = !aBoolean349;
		}
		for (;;) {
			int i_25_ = packet.getUByte();
			if (i_25_ == 0) {
				break;
			}
			if (i_25_ == 1) {
				anInt360 = packet.getUShort();
			} else if (i_25_ == 2) {
				examine = packet.getString();
			} else if (i_25_ == 3) {
				aByteArray328 = packet.getBytes();
			} else if (i_25_ == 4) {
				zoom = packet.getUShort();
			} else if (i_25_ == 5) {
				anInt359 = packet.getUShort();
			} else if (i_25_ == 6) {
				anInt356 = packet.getUShort();
			} else if (i_25_ == 7) {
				anInt327 = packet.getUShort();
				if (anInt327 > 32767) {
					anInt327 -= 65536;
				}
			} else if (i_25_ == 8) {
				anInt340 = packet.getUShort();
				if (anInt340 > 32767) {
					anInt340 -= 65536;
				}
			} else if (i_25_ == 10) {
				anInt372 = packet.getUShort();
			} else if (i_25_ == 11) {
				aBoolean371 = true;
			} else if (i_25_ == 12) {
				anInt345 = packet.getInt();
			} else if (i_25_ == 16) {
				aBoolean377 = true;
			} else if (i_25_ == 23) {
				anInt353 = packet.getUShort();
				equipOffset1 = packet.getByte();
			} else if (i_25_ == 24) {
				anInt331 = packet.getUShort();
			} else if (i_25_ == 25) {
				anInt326 = packet.getUShort();
				equipOffset2 = packet.getByte();
			} else if (i_25_ == 26) {
				anInt355 = packet.getUShort();
			} else if (i_25_ >= 30 && i_25_ < 35) {
				if (aStringArray338 == null) {
					aStringArray338 = new String[5];
				}
				aStringArray338[i_25_ - 30] = packet.getString();
				if (aStringArray338[i_25_ - 30].equalsIgnoreCase("hidden")) {
					aStringArray338[i_25_ - 30] = null;
				}
			} else if (i_25_ >= 35 && i_25_ < 40) {
				if (actions == null) {
					actions = new String[5];
				}
				actions[i_25_ - 35] = packet.getString();
			} else if (i_25_ == 40) {
				int i_26_ = packet.getUByte();
				anIntArray364 = new int[i_26_];
				anIntArray341 = new int[i_26_];
				for (int i_27_ = 0; i_27_ < i_26_; i_27_++) {
					anIntArray364[i_27_] = packet.getUShort();
					anIntArray341[i_27_] = packet.getUShort();
				}
			} else if (i_25_ == 78) {
				anInt370 = packet.getUShort();
			} else if (i_25_ == 79) {
				anInt367 = packet.getUShort();
			} else if (i_25_ == 90) {
				anInt334 = packet.getUShort();
			} else if (i_25_ == 91) {
				anInt375 = packet.getUShort();
			} else if (i_25_ == 92) {
				anInt361 = packet.getUShort();
			} else if (i_25_ == 93) {
				anInt362 = packet.getUShort();
			} else if (i_25_ == 95) {
				anInt339 = packet.getUShort();
			} else if (i_25_ == 97) {
				anInt333 = packet.getUShort();
			} else if (i_25_ == 98) {
				anInt343 = packet.getUShort();
			} else if (i_25_ >= 100 && i_25_ < 110) {
				if (anIntArray365 == null) {
					anIntArray365 = new int[10];
					anIntArray376 = new int[10];
				}
				anIntArray365[i_25_ - 100] = packet.getUShort();
				anIntArray376[i_25_ - 100] = packet.getUShort();
			} else if (i_25_ == 110) {
				scale1 = packet.getUShort();
			} else if (i_25_ == 111) {
				scale2 = packet.getUShort();
			} else if (i_25_ == 112) {
				scale3 = packet.getUShort();
			} else if (i_25_ == 113) {
				anInt354 = packet.getByte();
			} else if (i_25_ == 114) {
				anInt358 = packet.getByte() * 5;
			} else if (i_25_ == 115) {
				anInt332 = packet.getUByte();
			}
		}
	}

	public final Model method219(int i) {
		int i_28_ = anInt334;
		int i_29_ = anInt361;
		if (i == 1) {
			i_28_ = anInt375;
			i_29_ = anInt362;
		}
		if (i_28_ == -1) {
			return null;
		}
		Model model = Model.method588(i_28_);
		if (i_29_ != -1) {
			Model model_30_ = Model
				.method588(i_29_);
			Model[] class50_sub1_sub4_sub4s = { model,
				model_30_ };
			model = new Model(2, class50_sub1_sub4_sub4s,
				(byte) -89);
		}
		if (anIntArray364 != null) {
			for (int i_31_ = 0; i_31_ < anIntArray364.length; i_31_++) {
				model.method602(anIntArray364[i_31_], anIntArray341[i_31_]);
			}
		}
		return model;
	}

	public final Model method220(int i) {
		if (anIntArray365 != null && i > 1) {
			int i_32_ = -1;
			for (int i_33_ = 0; i_33_ < 10; i_33_++) {
				if (i >= anIntArray376[i_33_] && anIntArray376[i_33_] != 0) {
					i_32_ = anIntArray365[i_33_];
				}
			}
			if (i_32_ != -1) {
				return ItemDefinition.method212(i_32_).method220(1);
			}
		}
		Model model = (Model) ItemDefinition.aCache_337
			.method345(anInt363);
		if (model != null) {
			return model;
		}
		model = Model.method588(anInt360);
		if (model == null) {
			return null;
		}
		if (scale1 != 128 || scale2 != 128 || scale3 != 128) {
			model.method604(scale2, scale3, 9, scale1);
		}
		if (anIntArray364 != null) {
			for (int i_34_ = 0; i_34_ < anIntArray364.length; i_34_++) {
				model.method602(anIntArray364[i_34_], anIntArray341[i_34_]);
			}
		}
		model.preProcess(anInt354 + 64, anInt358 + 768, -50, -10, -50, true);
		model.aBoolean1680 = true;
		ItemDefinition.aCache_337.method346(model, anInt363);
		return model;
	}

	public static final Sprite method221(byte i, int i_35_, int i_36_, int i_37_) {
		if (i_35_ == 0) {
			Sprite sprite = ((Sprite) ItemDefinition.aCache_346
				.method345(i_37_));
			if (sprite != null && sprite.trimHeight != i_36_
				&& sprite.trimHeight != -1) {
				sprite.method453();
				sprite = null;
			}
			if (sprite != null) {
				return sprite;
			}
		}
		ItemDefinition itemDefinition = ItemDefinition.method212(i_37_);
		if (itemDefinition.anIntArray365 == null) {
			i_36_ = -1;
		}
		if (i_36_ > 1) {
			int i_38_ = -1;
			for (int i_39_ = 0; i_39_ < 10; i_39_++) {
				if (i_36_ >= itemDefinition.anIntArray376[i_39_] && itemDefinition.anIntArray376[i_39_] != 0) {
					i_38_ = itemDefinition.anIntArray365[i_39_];
				}
			}
			if (i_38_ != -1) {
				itemDefinition = ItemDefinition.method212(i_38_);
			}
		}
		Model model = itemDefinition.method220(1);
		if (model == null) {
			return null;
		}
		Sprite sprite = null;
		if (itemDefinition.anInt343 != -1) {
			sprite = ItemDefinition.method221((byte) -33, -1, 10, itemDefinition.anInt333);
			if (sprite == null) {
				return null;
			}
		}
		Sprite sprite_40_ = new Sprite(32, 32);
		int i_41_ = Renderer3D.anInt1532;
		int i_42_ = Renderer3D.anInt1533;
		int[] is = Renderer3D.anIntArray1538;
		int[] is_43_ = Renderer2D.pixels;
		int i_44_ = Renderer2D.width;
		int i_45_ = Renderer2D.height;
		int i_46_ = Renderer2D.topX;
		int i_47_ = Renderer2D.bottomX;
		int i_48_ = Renderer2D.topY;
		int i_49_ = Renderer2D.bottomY;
		Renderer3D.aBoolean1530 = false;
		Renderer2D.method455(32, 32, sprite_40_.pixels);
		Renderer2D.method460(32, 0, 0, (byte) -24, 32, 0);
		Renderer3D.method504(568);
		int i_50_ = itemDefinition.zoom;
		if (i_35_ == -1) {
			i_50_ *= 1.5;
		}
		if (i_35_ > 0) {
			i_50_ *= 1.04;
		}
		int i_51_ = (Renderer3D.anIntArray1536[itemDefinition.anInt359] * i_50_ >> 16);
		int i_52_ = (Renderer3D.anIntArray1537[itemDefinition.anInt359] * i_50_ >> 16);
		model.method609(0, itemDefinition.anInt356, itemDefinition.anInt339, itemDefinition.anInt359,
			itemDefinition.anInt327, (i_51_ + (model.anInt1475 / 2) + itemDefinition.anInt340),
			i_52_ + itemDefinition.anInt340);
		for (int i_53_ = 31; i_53_ >= 0; i_53_--) {
			for (i_52_ = 31; i_52_ >= 0; i_52_--) {
				if ((sprite_40_.pixels[i_53_ + i_52_ * 32]) == 0) {
					if (i_53_ > 0
						&& (sprite_40_.pixels[i_53_ - 1 + i_52_ * 32]) > 1) {
						sprite_40_.pixels[i_53_ + i_52_ * 32] = 1;
					} else if (i_52_ > 0
						&& (sprite_40_.pixels[i_53_ + (i_52_ - 1) * 32]) > 1) {
						sprite_40_.pixels[i_53_ + i_52_ * 32] = 1;
					} else if (i_53_ < 31
						&& (sprite_40_.pixels[i_53_ + 1 + i_52_ * 32]) > 1) {
						sprite_40_.pixels[i_53_ + i_52_ * 32] = 1;
					} else if (i_52_ < 31
						&& (sprite_40_.pixels[i_53_ + (i_52_ + 1) * 32]) > 1) {
						sprite_40_.pixels[i_53_ + i_52_ * 32] = 1;
					}
				}
			}
		}
		if (i_35_ > 0) {
			for (int i_54_ = 31; i_54_ >= 0; i_54_--) {
				for (i_52_ = 31; i_52_ >= 0; i_52_--) {
					if ((sprite_40_.pixels[i_54_ + i_52_ * 32]) == 0) {
						if (i_54_ > 0
							&& (sprite_40_.pixels[i_54_ - 1 + i_52_ * 32]) == 1) {
							sprite_40_.pixels[i_54_ + i_52_ * 32] = i_35_;
						} else if (i_52_ > 0
							&& (sprite_40_.pixels[i_54_ + (i_52_ - 1) * 32]) == 1) {
							sprite_40_.pixels[i_54_ + i_52_ * 32] = i_35_;
						} else if (i_54_ < 31
							&& (sprite_40_.pixels[i_54_ + 1 + i_52_ * 32]) == 1) {
							sprite_40_.pixels[i_54_ + i_52_ * 32] = i_35_;
						} else if (i_52_ < 31
							&& (sprite_40_.pixels[i_54_ + (i_52_ + 1) * 32]) == 1) {
							sprite_40_.pixels[i_54_ + i_52_ * 32] = i_35_;
						}
					}
				}
			}
		} else if (i_35_ == 0) {
			for (int i_55_ = 31; i_55_ >= 0; i_55_--) {
				for (i_52_ = 31; i_52_ >= 0; i_52_--) {
					if ((sprite_40_.pixels[i_55_ + i_52_ * 32]) == 0
						&& i_55_ > 0
						&& i_52_ > 0
						&& (sprite_40_.pixels[i_55_ - 1 + (i_52_ - 1) * 32]) > 0) {
						sprite_40_.pixels[i_55_ + i_52_ * 32] = 3153952;
					}
				}
			}
		}
		if (itemDefinition.anInt343 != -1) {
			int i_56_ = sprite.trimWidth;
			int i_57_ = sprite.trimHeight;
			sprite.trimWidth = 32;
			sprite.trimHeight = 32;
			sprite.drawSprite(0, 0);
			sprite.trimWidth = i_56_;
			sprite.trimHeight = i_57_;
		}
		if (i_35_ == 0) {
			ItemDefinition.aCache_346.method346(sprite_40_, i_37_);
		}
		Renderer2D.method455(i_44_, i_45_, is_43_);
		Renderer2D.method457(i_48_, i_46_, i_49_, i_47_, true);
		Renderer3D.anInt1532 = i_41_;
		Renderer3D.anInt1533 = i_42_;
		Renderer3D.anIntArray1538 = is;
		Renderer3D.aBoolean1530 = true;
		if (itemDefinition.aBoolean371) {
			sprite_40_.trimWidth = 33;
		} else {
			sprite_40_.trimWidth = 32;
		}
		sprite_40_.trimHeight = i_36_;
		if (i != -33) {
			throw new NullPointerException();
		}
		return sprite_40_;
	}

	public static final void method222(boolean bool) {
		ItemDefinition.aCache_337 = null;
		if (bool) {
			for (int i = 1; i > 0; i++) {
				/* empty */
			}
		}
		ItemDefinition.aCache_346 = null;
		ItemDefinition.anIntArray342 = null;
		ItemDefinition.items = null;
		ItemDefinition.aPacket_373 = null;
	}

	public final void method223() {
		anInt360 = 0;
		examine = null;
		aByteArray328 = null;
		anIntArray364 = null;
		anIntArray341 = null;
		zoom = 2000;
		anInt359 = 0;
		anInt356 = 0;
		anInt339 = 0;
		anInt327 = 0;
		anInt340 = 0;
		anInt372 = -1;
		aBoolean371 = false;
		anInt345 = 1;
		aBoolean377 = false;
		aStringArray338 = null;
		actions = null;
		anInt353 = -1;
		anInt331 = -1;
		equipOffset1 = (byte) 0;
		anInt326 = -1;
		anInt355 = -1;
		equipOffset2 = (byte) 0;
		anInt370 = -1;
		anInt367 = -1;
		anInt334 = -1;
		anInt361 = -1;
		anInt375 = -1;
		anInt362 = -1;
		anIntArray365 = null;
		anIntArray376 = null;
		anInt333 = -1;
		anInt343 = -1;
		scale1 = 128;
		scale2 = 128;
		scale3 = 128;
		anInt354 = 0;
		anInt358 = 0;
		anInt332 = 0;
	}
}
